import React from 'react'
import { BrowserRouter,HashRouter, Route, Switch } from 'react-router-dom'
import App from './App';
import Login from './pages/login';
import Admin from './admin';
import Buttons from './pages/ui/buttons.js';
import NoMatch from './pages/nomatch';
import Modals from './pages/ui/modals.js';
import Loadings from './pages/ui/loadings.js';
import BasicTable from './pages/table/basicTable.js';
import City from './pages/city';
import User from './pages/user';
import Order from './pages/order';

export default class  IRouter extends React.Component{

    render(){
        let LayoutRouter = (
            <Admin>
                <Switch>
                    <Route exact path="/" component={Buttons} />
                    <Route path="/ui/buttons" component={Buttons} />
                    <Route path="/ui/modals" component={Modals} />
                    <Route path="/ui/loadings" component={Loadings} />
                    <Route path="/table/basic" component={BasicTable} />
                    <Route path="/city" component={City} />
                    <Route path="/user" component={User} />
                    <Route path="/order" component={Order} />
                    <Route component={NoMatch} />
                </Switch>
            </Admin>
        );
        return (
            <BrowserRouter>
                <App>
                    <Switch>
                        <Route path="/login" component={Login}/>
                        <Route path="/" render={ props => LayoutRouter} />
                    </Switch>
                </App>
            </BrowserRouter>
        );
    }

}